cmake_minimum_required(VERSION 3.12)
project(OSQP_Demo)

# 设置C标准
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找已安装的OSQP库
# find_package(osqp REQUIRED
#     PATHS "${CMAKE_SOURCE_DIR}/../_install"
#     NO_DEFAULT_PATH
# )
set(osqp_DIR "${CMAKE_SOURCE_DIR}/../3rdparty/osqp-100/_install_x86_64/lib/cmake/osqp")
find_package(osqp)
if(osqp_FOUND)
    message(STATUS "Found OSQP library")
    message(STATUS "OSQP shared library available: ${OSQP_HAVE_SHARED_LIB}")
    message(STATUS "OSQP static library available: ${OSQP_HAVE_STATIC_LIB}")
else()
    message(FATAL_ERROR "OSQP library not found")
endif()

add_executable(osqp_test_shared main_osqp.cpp)

add_executable(osqp_test_static main_osqp.cpp)

# target_include_directories(osqp_demo PRIVATE
#     "${CMAKE_SOURCE_DIR}/../_install/include"
#     "${CMAKE_SOURCE_DIR}/../_install/include/osqp"
#     "${CMAKE_SOURCE_DIR}/../_install/share/osqp"
# )

# 链接动态库
target_link_libraries(osqp_test_shared PRIVATE osqp::osqp)

# 链接静态库
target_link_libraries(osqp_test_static PRIVATE osqp::osqpstatic)